<%@ page language="java" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
	<title>学生考试成绩管理系统</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
    
        <link href="<%=path %>/css/login.css" rel="stylesheet" type="text/css">
 
 
 
 <script type='text/javascript' src='<%=path %>/dwr/interface/loginService.js'></script>
 <script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
 <script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
      
 <script language="javascript">
		function check1()
		{                                                                                         
		     if(document.ThisForm.userName.value=="")
			 {
			 	alert("请输入用户名");
				document.ThisForm.userName.focus();
				return false;
			 }
			 if(document.ThisForm.userPw.value=="")
			 {
			 	alert("请输入密码");
				document.ThisForm.userPw.focus();
				return false;
			 }
			 document.getElementById("indicator").style.display="block";
			 loginService.login(document.ThisForm.userName.value,document.ThisForm.userPw.value,document.ThisForm.utype.value,callback);
		}
		
		function callback(data)
		{
		    document.getElementById("indicator").style.display="none";
		    if(data=="no")
		    {
		        alert("用户名或密码错误");
		    }
		    if(data=="yes")
		    {
		        alert("通过验证,系统登录成功");
		        window.location.href="<%=path %>/loginSuccess.jsp";
		    }
		    
		}
		function register(){
		    document.ThisForm.userName.value="";
		    document.ThisForm.userPw.value="";
		}
	    </script>
</head>
 <html> 
 <body class="loginPageBody">
 <form action="" name="ThisForm" method="post">
    <div class="LoginWrapbg">
        <div style="width: 100%; height: 50%; left: 0; top: 0; z-index: -1;"></div>
        <div style="width: 442px; height: 440px; margin: 0 auto; margin-top: -260px;">
            <div class="loginLogo"></div>
            <div class="welcome">欢迎登录学生考试成绩管理系统</div>
           <div class="loginBar" id="loginBar">
            <div class="">
                <div class="fieldWrap">
                    <div class="lable">
                        用户名：</div>
                    <div class="inputWrap">
                        <input  name="userName" type="text" class="inputText"  id="userName" onfocus="this.select();"></div>
                </div>
                <div class="fieldWrap">
                    <div class="lable">
                        密码：</div>
                    <div class="inputWrap">
                        <input name="userPw" type="password" class="inputText" id="userPw" onfocus="this.select();"></div>
                </div>
                <div class="fieldWrap">
                    <div class="lable">
                      用户类型：</div>
                    <div class="inputWrap">
                    
                     <select name="utype" class="inputText" style="width: 200px;text-transform:uppercase;height: 27px">
           
           <option value="2">学生</option>
             <option value="1">老师</option>
            <option value="0">管理员</option>
         </select>
         
                    </div>
                </div>
               <div class="fieldWrap" id="loginBtnWrap">
                <a href="javascript:void(0);" class="inline-block regBtn" onclick="check1();">登录</a>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <a href="javascript:void(0);" onclick="register();" class="inline-block loginBtn">重置</a>
               </div>
               <div class="fieldWrap" id="Div1" style="padding-left:150px;">
                 <img id="indicator" src="<%=path %>/img/loading.gif" style="display:none"/>
               </div>
            </div>
           </div>
         </div>
         <div class="copyright">
            <div class="center">
                Copyright &#169; 2019 - 2020. 学生考试成绩管理系统 All Rights Reserved. 技术支持QQ：122223333.
            </div>
        </div>
    </div>
</form>

</body></html>
